package com.cat.flyweight;

/**
 * @author cat
 * @version 2025/5/24 18:55
 * @description
 * @since JDK17
 */

public class Client {
    public static void main(String[] args) {
        // 获取I图形对象
        AbstractBox i = BeanFactory.getInstance().getShape("I");
        i.display("gray");
        // 获取L图形对象
        AbstractBox l = BeanFactory.getInstance().getShape("O");
        l.display("gray");
        // 获取I图形对象
        AbstractBox o = BeanFactory.getInstance().getShape("O");
        o.display("gray");
        // 获取I图形对象
        AbstractBox o1 = BeanFactory.getInstance().getShape("O");
        i.display("red");
        System.out.println(o == o1);

    }
}
